package com.example.zk.viewModel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.base.entity.CategoryEntityResult
import com.example.base.mvvm.BaseViewModel
import kotlinx.coroutines.launch

class MainViewModel:BaseViewModel() {
    val categorySuccess = MutableLiveData<CategoryEntityResult>()
    val categoryFail  = MutableLiveData<String>()
    fun category(){
        viewModelScope.launch {
            try {
                categorySuccess.value = apiService.category()
            }catch (e:Exception){
                categoryFail.value = e.message
            }
        }
    }
}